public class InnerSingleton {
    private InnerSingleton() {
    }

    public static InnerSingleton getInstance() {
        return InnerClass.INSTANCE;
    }

    /**
     * 内部类延迟加载，并且JVM保证类加载过程的线程安全
     */
    static class InnerClass {
        private static final InnerSingleton INSTANCE = new InnerSingleton();
    }
}
